#ifndef __MYURL_H__
#define __MYURL_H__

#ifdef  __cplusplus
extern "C" {
#endif

extern int  urlencode (char*, const char*, const int);
extern int  urldecode (char*, const char*, const int);

extern bool parse_url (const char *url, char *host, int *port, char *path, char **query);

#ifdef  __cplusplus
}

#include <string>
#include <map>

extern bool urlencode (std::string&, const char*);
extern bool urlencode (std::string&, const std::string&);
extern bool urlencode (std::string&, const char*, const int);

extern bool urldecode (std::string&, char*);
extern bool urldecode (std::string&, const std::string&);
extern bool urldecode (std::string&, const char*, const int);

extern bool parse_query(const char* str, const int size, std::map<std::string, std::string> &m);

#endif

#endif // __MYURL_H__


